/* This class will get the Carbs that the user will input eiher manually or selecting items from 
 *the list in the Bolus screen 
 */
package sip;
import java.text.DecimalFormat;

/**
 *
 * @author arianareyessantiago
 */
public class Bolus{
    Double conversionRate = 13.00;//1 Unit of insulin per carb
    public static double bolusInsulin = 0;
    private Double bolusAmount = 0.00;
    public void totalInsulin(Double currentTotalCarbs){
        bolusInsulin = roundFiveDecimals(currentTotalCarbs/conversionRate);
        //SipLogger.Instance().debug("I updated the bolusInsulin inside the Bolus class.");
//        System.out.println("From Bolus class:" + insulinUnits);
    }
    
    public double getBolusInsulin(){
        bolusAmount = roundFiveDecimals(bolusInsulin);
    return bolusAmount;
}
 
    public double roundFiveDecimals(double d){
        DecimalFormat fiveDForm = new DecimalFormat("#.#####");
        return Double.valueOf(fiveDForm.format(d));
    }
    public String [] chooseSubList(String itemOption){
        String [] breakfastArray = {"Cereal -- 5 g", "Bagel -- 15 g", "Toast -- 15 g", "Egg -- 5 g"};
        String [] meatArray = {"Bacon -- 10 g", "Turkey -- 8 g", "Chicken -- 9 g"};
        String [] fishArray = {"Salmon -- 12 g", "Tilapia -- 7 g", "Tuna -- 5 g", "Shrimp -- 9 g"};
        String [] snacksArray = {"Almonds -- 25 g", "Greek Yogurt -- 9 g", "Yogurt -- 8 g", "Apple -- 10 g", "Carrots -- 7 g"};
        String [] juicesArray = {"Apple -- 19 g", "Orange -- 15 g", "Cranberry -- 10 g", "Grape -- 12 g"};
        String [] subList = {};
        if("Breakfast".equals(itemOption)) {
            subList = breakfastArray;
        } else if ("Meat".equals(itemOption)){
           subList = meatArray;
        } else if ("Snacks".equals(itemOption)){
            subList = snacksArray;
        } else if ("Fish".equals(itemOption)){
            subList = fishArray;
        } else if ("Juices".equals(itemOption)){
            subList = juicesArray;
        }
        return subList;
    }
}
